//
//  HomeFooterView.m
//  爱鲜蜂
//
//  Created by 廖易诚 on 16/8/31.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "HomeFooterView.h"
#import "HomeFreshHotView.h"

@interface HomeFooterView ()

///
@property (nonatomic, weak) UILabel *titleLabel;

@property (nonatomic, weak) HomeFreshHotView *freshHotView;


@end

@implementation HomeFooterView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor colorWithRed:249/255.0 green:247/255.0 blue:247/255.0 alpha:1];
        
        UILabel *titleLabel = [[UILabel alloc] init];
        [self addSubview:titleLabel];
        titleLabel.text = @"新鲜热卖";
        self.titleLabel = titleLabel;
        [titleLabel sizeToFit];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(10);
            make.top.mas_equalTo(20);
        }];
        
        HomeFreshHotView *freshHotView = [[HomeFreshHotView alloc] initWithFrame:CGRectMake(10, 50, self.hm_width-20, frame.size.height-50) collectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
        freshHotView.contentSize = CGSizeMake(frame.size.width, frame.size.height - 50);
        [self addSubview:freshHotView];
        self.freshHotView = freshHotView;
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.freshHotView.hm_height = self.hm_height - 50;
}

- (void)setDatas:(NSArray *)datas {
    self.freshHotView.datas = datas;
}


@end
